package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.domain.ExinspCpPower;
import com.deyuanyun.pic.ctrl.enumeration.AbnormalEnum;
import com.deyuanyun.pic.ctrl.enumeration.DownReasonEnum;
import com.deyuanyun.pic.ctrl.enumeration.EqptRunningStatedEnum;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;

/**
 * 阴保电源检测记录表 视图对象
 *
 * @author huanglw
 * @date  2016-9-7
 *
 * History: [修改人][时间][修改描述]
 */
public class ExinspCpPowerVO extends ExinspBaseVO<ExinspCpPower> {

    // 阴保电源编号
    private String cppowerNum;
    // 设备编号(自定义编号)
    private String customNumber;
    // 所属场站阀室
    private String valveRoomName;
    // 输出电压（V）
    private BigDecimal outputVoltage;
    // 输出电流（A）
    private BigDecimal outputCurrent;
    // 控制电位（mV）
    private BigDecimal settingPotential;
    // 通电点电位（mV）
    private BigDecimal metricalPotential;
    // 运行状态（运行中、已报废、维修中、闲置中）
    private String activeStated;
    // 停机时间_开始
    private String downBeginDate;
    // 停机时间_结束
    private String downEndDate;
    // 停机原因
    private String downReason;
    // 接地和避雷器设施检查维护
    private String grounding;
    // 年检修记录
    private String annualRepairRecord;
    // 是否有异常(YES、NO)
    private String abnormal;
    // 异常记录
    private String faultRecord;
    // 处理措施
    private String treatmentMeasures;
    // 电缆及连接端子检测维护
    private String connectionCheck;
    // 仪表校准
    private String instrumentCalibration;
    // 检测单位
    private String testingCompany;
    // 检测日期
    private String detectiongDete;

    public String getCppowerNum() {
        return cppowerNum;
    }

    public void setCppowerNum(String cppowerNum) {
        this.cppowerNum = cppowerNum;
    }

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getValveRoomName() {
        return valveRoomName;
    }

    public void setValveRoomName(String valveRoomName) {
        this.valveRoomName = valveRoomName;
    }

    public BigDecimal getOutputVoltage() {
        return outputVoltage;
    }

    public void setOutputVoltage(BigDecimal outputVoltage) {
        this.outputVoltage = outputVoltage;
    }

    public BigDecimal getOutputCurrent() {
        return outputCurrent;
    }

    public void setOutputCurrent(BigDecimal outputCurrent) {
        this.outputCurrent = outputCurrent;
    }

    public BigDecimal getSettingPotential() {
        return settingPotential;
    }

    public void setSettingPotential(BigDecimal settingPotential) {
        this.settingPotential = settingPotential;
    }

    public BigDecimal getMetricalPotential() {
        return metricalPotential;
    }

    public void setMetricalPotential(BigDecimal metricalPotential) {
        this.metricalPotential = metricalPotential;
    }

    public String getActiveStated() {
        return activeStated;
    }

    public void setActiveStated(String activeStated) {
        this.activeStated = activeStated;
    }

    public String getDownBeginDate() {
        return downBeginDate;
    }

    public void setDownBeginDate(String downBeginDate) {
        this.downBeginDate = downBeginDate;
    }

    public String getDownEndDate() {
        return downEndDate;
    }

    public void setDownEndDate(String downEndDate) {
        this.downEndDate = downEndDate;
    }

    public String getDownReason() {
        return downReason;
    }

    public void setDownReason(String downReason) {
        this.downReason = downReason;
    }

    public String getGrounding() {
        return grounding;
    }

    public void setGrounding(String grounding) {
        this.grounding = grounding;
    }

    public String getAnnualRepairRecord() {
        return annualRepairRecord;
    }

    public void setAnnualRepairRecord(String annualRepairRecord) {
        this.annualRepairRecord = annualRepairRecord;
    }

    public String getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(String abnormal) {
        this.abnormal = abnormal;
    }

    public String getFaultRecord() {
        return faultRecord;
    }

    public void setFaultRecord(String faultRecord) {
        this.faultRecord = faultRecord;
    }

    public String getTreatmentMeasures() {
        return treatmentMeasures;
    }

    public void setTreatmentMeasures(String treatmentMeasures) {
        this.treatmentMeasures = treatmentMeasures;
    }

    public String getConnectionCheck() {
        return connectionCheck;
    }

    public void setConnectionCheck(String connectionCheck) {
        this.connectionCheck = connectionCheck;
    }

    public String getInstrumentCalibration() {
        return instrumentCalibration;
    }

    public void setInstrumentCalibration(String instrumentCalibration) {
        this.instrumentCalibration = instrumentCalibration;
    }

    public String getTestingCompany() {
        return testingCompany;
    }

    public void setTestingCompany(String testingCompany) {
        this.testingCompany = testingCompany;
    }

    public String getDetectiongDete() {
        return detectiongDete;
    }

    public void setDetectiongDete(String detectiongDete) {
        this.detectiongDete = detectiongDete;
    }

    public void fromDomain(ExinspCpPower domain) {

        // 阴保电源编号
        this.cppowerNum = domain.getCustomNumber();
        // 所属场站阀室
        this.valveRoomName = PipeLineUtil.getValveRoomName(domain.getCreateRemark());
        // 输出电压（V）
        this.outputVoltage = domain.getOutputVoltage();
        // 输出电流（A）
        this.outputCurrent = domain.getOutputCurrent();
        // 控制电位（mV）
        this.settingPotential = domain.getSettingPotential();
        // 通电点电位（mV）
        this.metricalPotential = domain.getMetricalPotential();
        // 运行状态（运行中、已报废、维修中、闲置中）
        this.activeStated = EqptRunningStatedEnum.getLabel(domain.getActiveStated());
        // 停机时间_开始
        this.downBeginDate = DateFormat.format(domain.getDownBeginDate(), DateFormat.FMT_DATE_TIME_DEFAULT);
        // 停机时间_结束
        this.downEndDate = DateFormat.format(domain.getDownEndDate(), DateFormat.FMT_DATE_TIME_DEFAULT);
        // 停机原因
        this.downReason = DownReasonEnum.getLabel(domain.getDownReason());
        // 接地和避雷器设施检查维护
        this.grounding = domain.getGrounding();
        // 仪表校准
        this.instrumentCalibration = domain.getInstrumentCalibration();
        // 电缆及连接端子检测维护
        this.connectionCheck = domain.getConnectionCheck();
        // 是否有异常(YES、NO)
        this.annualRepairRecord = domain.getAnnualRepairRecord();
        // 异常记录
        this.faultRecord = domain.getFaultRecord();
        // 是否有异常
        this.abnormal = AbnormalEnum.getLabel(domain.getAbnormal());
        // 处理措施
        this.treatmentMeasures = domain.getUpdateRemark();;
        // 检测日期
        this.detectiongDete = DateFormat.format(domain.getDetectiongDete());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspCpPowerVO> fromDomainList(Page<ExinspCpPower> domainList) {

        Page<ExinspCpPowerVO> list = new Page<ExinspCpPowerVO>();
        for (ExinspCpPower exinspCpPower : domainList) {
            ExinspCpPowerVO exinspCpPowerVO = new ExinspCpPowerVO();
            exinspCpPowerVO.fromDomain(exinspCpPower);
            list.add(exinspCpPowerVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}